﻿using System;

namespace TextEditor
{
    

    public class A_InsertLine : A_Action
    {
        public override string ActionName()
        {
            return "insertline";
        }

        public override bool Execute()
        {
            ZYTextElement currentElement = base.OwnerDocument.Content.CurrentElement;
       
            ZYTextHRule newElement = new ZYTextHRule();
            base.myOwnerDocument._InsertElement(newElement); 
            /***
             * 分页符
             */
            //if (currentElement.Parent == base.myOwnerDocument.DocumentElement)
            //{
            //if (currentElement is ZYTextParagraph)
            //{
            //    ((ZYTextParagraph)currentElement).SkipPage = true;
            //}
            //else
            //{
            //    ZYTextParagraph p = new ZYTextParagraph();
            //    p.SkipPage = true;
            //    base.myOwnerDocument._InsertElement(p);
            //}
            //base.OwnerDocument.ContentChanged();
            //}
            return true;
        }

        public override bool isEnable()
        {
            return (base.myOwnerDocument.CanModify() && base.isEnable());
        }
    }
}

